import { 
  USER_PROFILE
} from '../constants';

const initialState = {
  isNewUser: false,
  userId: null,
  userName: null,
  userImg: null,
  wrap: null,
  sex: null,
  state: null,
  birth: null,
  college: null,
  professional: null,
  studentId: null,
  collegeEntry: null,
  notes: null
};

function func(state = initialState, action) {
  switch (action.type) {
    case USER_PROFILE:
      return Object.assign({}, state, {
        isNewUser: action.payload.is_new_user,
        userId: action.payload.id,
  	    userName: action.payload.user_name,
  	    userImg: action.payload.user_img,
  	    wrap: action.payload.wrap,
        sex: action.payload.sex,
        state: action.payload.state,
        birth: action.payload.birth,
        college: action.payload.college,
        professional: action.payload.professional,
        studentId: action.payload.student_id,
        collegeEntry: action.payload.college_entry,
        notes: action.payload.notes
      });
    default:
      return state
  }
};

export default func;